<?php echo $form->renderFormTag('#', array('id' => 'form', 'method' => "post", "class" => "form")) ?>
<?= $form->renderHiddenFields() ?>
<fieldset>
    <div class="widget">
        <div class="title"> <?= image_tag('icons/color/plus.png', array("class" => "titleIcon")); ?><h6>Edit Collection</h6></div>
        <div class="fluid">

            <div class="formRow">
                <label>Code:</label>
                <div class="formRight">
                    <span class="span6"><?php echo $form['collection_code']->render(); ?> </span>
                    <span class="span6"><label for="collection_code" generated="true" class="error"><?= $form['collection_code']->renderError(); ?></label></span>
                </div>
            </div>
            
            <div class="formRow">
                <label>Customer:</label>
                <div class="formRight">
                    <span class="span6"><?php echo $form['customer_id']->render(array('data-placeholder' => " - - Select - - ", 'style' => "width:100%;", 'class' => "chzn-select")); ?> </span>
                    <span class="span6"><label for="customer_id" generated="true" class="error"><?= $form['customer_id']->renderError(); ?></label></span>
                </div>
            </div>

            <div class="formRow">
                <label>Line:</label>
                <div class="formRight">
                    <span class="span6"><?php echo $form['line_id']->render(array('data-placeholder' => " - - Select - - ", 'style' => "width:100%;", 'class' => "chzn-select")); ?> </span>
                    <span class="span6"><label for="line_id" generated="true" class="error"><?= $form['line_id']->renderError(); ?></label></span>
                </div>
            </div>

            <div class="formRow">
                <label>Date:</label>
                <div class="formRight">
                    <span class="span6"><?php echo $form['date']->render(array('class' => 'datepicker','readonly'=>'readonly')); ?> </span>
                    <span class="span6"><label for="date" generated="true" class="error"><?= $form['date']->renderError(); ?></label></span>
                </div>
            </div>
         
            <div class="formRow">
                <label>Payment Method:</label>
                <div class="formRight"><?php $x =  $form['pay_type']->getValue(); ?>
                    <span class="span3"><input type="radio" <?= ($x == 'cheque')?'checked':''; ?> id="collection_pay_type_cheque" value="cheque" name="collection[pay_type]"> Cheque </span>
                    <span class="span3"><input type="radio" <?= ($x == 'cash')?'checked':''; ?> id="collection_pay_type_cash" value="cash" name="collection[pay_type]"> Cash </span>
                    <span class="span3"><input type="radio" <?= ($x == 'transfer')?'checked':''; ?> id="collection_pay_type_transfer" value="transfer" name="collection[pay_type]"> Transfer </span>
                    <span class="span6"><label for="pay_type" generated="true" class="error"><?= $form['pay_type']->renderError(); ?></label></span>
                </div>
                <div class="formRight" id="chequeDiv1">
                    <span class="span3"><span class="formNote">Cheque Number</span><?php echo $form['cheque_number']->render(); ?> </span>
                    <span class="span3"><span class="formNote">Bank Name</span><?php echo $form['bank_name']->render(); ?> </span>
                    <span class="span3"><span class="formNote">Due Date</span><?php echo $form['due_date']->render(array('class' => 'datepicker','readonly'=>'readonly')); ?> </span>
                </div>
                <div class="formRight" id="chequeDiv2">
                    <span class="span3"><label for="cheque_number" generated="true" class="error"><?= $form['cheque_number']->renderError(); ?></label></span>
                    <span class="span3"><label for="cheque_number" generated="true" class="error"><?= $form['bank_name']->renderError(); ?></label></span>
                    <span class="span3"><label for="due_date" generated="true" class="error"><?= $form['due_date']->renderError(); ?></label></span>
                </div>

            </div>
            
            <div class="formRow">
                <label>Amount:</label>
                <div class="formRight">
                    <span class="span6"><?php echo $form['amount']->render(); ?> </span>
                    <span class="span6"><label for="amount" generated="true" class="error"><?= $form['amount']->renderError(); ?></label></span>
                </div>
            </div>

            <div class="wizButtons"> 
                <span class="wNavButtons">
                    <a class="wButton greenwB ml15 m10" title="" onClick="editCollection(true,false,<?= $collectionCode?>)" href="javascript:void(0);"><span> S u b m i t </span></a>
                </span>
            </div>
        </div>
    </div>
</fieldset>
</form>